
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta charset="utf-8" />
    <title>29. Python Runtime Services &#8212; Python 3.6.10 documentation</title>
    <link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/language_data.js"></script>
    
    <script type="text/javascript" src="../_static/sidebar.js"></script>
    
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python 3.6.10 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="next" title="29.1. sys — System-specific parameters and functions" href="sys.html" />
    <link rel="prev" title="28.4. zipapp — Manage executable python zip archives" href="zipapp.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
    <link rel="canonical" href="https://docs.python.org/3/library/python.html" />
    
    <script type="text/javascript" src="../_static/copybutton.js"></script>
    <script type="text/javascript" src="../_static/switchers.js"></script>
    
    
 

  </head><body>
  
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="sys.html" title="29.1. sys — System-specific parameters and functions"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="zipapp.html" title="28.4. zipapp — Manage executable python zip archives"
             accesskey="P">previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="https://www.python.org/">Python</a> &#187;</li>
        <li>
          <span class="language_switcher_placeholder">en</span>
          <span class="version_switcher_placeholder">3.6.10</span>
          <a href="../index.html">Documentation </a> &#187;
        </li>

          <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">The Python Standard Library</a> &#187;</li>
    <li class="right">
        

    <div class="inline-search" style="display: none" role="search">
        <form class="inline-search" action="../search.html" method="get">
          <input placeholder="Quick search" type="text" name="q" />
          <input type="submit" value="Go" />
          <input type="hidden" name="check_keywords" value="yes" />
          <input type="hidden" name="area" value="default" />
        </form>
    </div>
    <script type="text/javascript">$('.inline-search').show(0);</script>
         |
    </li>

      </ul>
    </div>    

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="python-runtime-services">
<span id="python"></span><h1><span class="section-number">29. </span>Python Runtime Services<a class="headerlink" href="#python-runtime-services" title="Permalink to this headline">¶</a></h1>
<p>The modules described in this chapter provide a wide range of services related
to the Python interpreter and its interaction with its environment.  Here’s an
overview:</p>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="sys.html">29.1. <code class="xref py py-mod docutils literal notranslate"><span class="pre">sys</span></code> — System-specific parameters and functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="sysconfig.html">29.2. <code class="xref py py-mod docutils literal notranslate"><span class="pre">sysconfig</span></code> — Provide access to Python’s configuration information</a><ul>
<li class="toctree-l2"><a class="reference internal" href="sysconfig.html#configuration-variables">29.2.1. Configuration variables</a></li>
<li class="toctree-l2"><a class="reference internal" href="sysconfig.html#installation-paths">29.2.2. Installation paths</a></li>
<li class="toctree-l2"><a class="reference internal" href="sysconfig.html#other-functions">29.2.3. Other functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="sysconfig.html#using-sysconfig-as-a-script">29.2.4. Using <code class="xref py py-mod docutils literal notranslate"><span class="pre">sysconfig</span></code> as a script</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="builtins.html">29.3. <code class="xref py py-mod docutils literal notranslate"><span class="pre">builtins</span></code> — Built-in objects</a></li>
<li class="toctree-l1"><a class="reference internal" href="__main__.html">29.4. <code class="xref py py-mod docutils literal notranslate"><span class="pre">__main__</span></code> — Top-level script environment</a></li>
<li class="toctree-l1"><a class="reference internal" href="warnings.html">29.5. <code class="xref py py-mod docutils literal notranslate"><span class="pre">warnings</span></code> — Warning control</a><ul>
<li class="toctree-l2"><a class="reference internal" href="warnings.html#warning-categories">29.5.1. Warning Categories</a></li>
<li class="toctree-l2"><a class="reference internal" href="warnings.html#the-warnings-filter">29.5.2. The Warnings Filter</a><ul>
<li class="toctree-l3"><a class="reference internal" href="warnings.html#default-warning-filters">29.5.2.1. Default Warning Filters</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="warnings.html#temporarily-suppressing-warnings">29.5.3. Temporarily Suppressing Warnings</a></li>
<li class="toctree-l2"><a class="reference internal" href="warnings.html#testing-warnings">29.5.4. Testing Warnings</a></li>
<li class="toctree-l2"><a class="reference internal" href="warnings.html#updating-code-for-new-versions-of-python">29.5.5. Updating Code For New Versions of Python</a></li>
<li class="toctree-l2"><a class="reference internal" href="warnings.html#available-functions">29.5.6. Available Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="warnings.html#available-context-managers">29.5.7. Available Context Managers</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="contextlib.html">29.6. <code class="xref py py-mod docutils literal notranslate"><span class="pre">contextlib</span></code> — Utilities for <code class="xref std std-keyword docutils literal notranslate"><span class="pre">with</span></code>-statement contexts</a><ul>
<li class="toctree-l2"><a class="reference internal" href="contextlib.html#utilities">29.6.1. Utilities</a></li>
<li class="toctree-l2"><a class="reference internal" href="contextlib.html#examples-and-recipes">29.6.2. Examples and Recipes</a><ul>
<li class="toctree-l3"><a class="reference internal" href="contextlib.html#supporting-a-variable-number-of-context-managers">29.6.2.1. Supporting a variable number of context managers</a></li>
<li class="toctree-l3"><a class="reference internal" href="contextlib.html#simplifying-support-for-single-optional-context-managers">29.6.2.2. Simplifying support for single optional context managers</a></li>
<li class="toctree-l3"><a class="reference internal" href="contextlib.html#catching-exceptions-from-enter-methods">29.6.2.3. Catching exceptions from <code class="docutils literal notranslate"><span class="pre">__enter__</span></code> methods</a></li>
<li class="toctree-l3"><a class="reference internal" href="contextlib.html#cleaning-up-in-an-enter-implementation">29.6.2.4. Cleaning up in an <code class="docutils literal notranslate"><span class="pre">__enter__</span></code> implementation</a></li>
<li class="toctree-l3"><a class="reference internal" href="contextlib.html#replacing-any-use-of-try-finally-and-flag-variables">29.6.2.5. Replacing any use of <code class="docutils literal notranslate"><span class="pre">try-finally</span></code> and flag variables</a></li>
<li class="toctree-l3"><a class="reference internal" href="contextlib.html#using-a-context-manager-as-a-function-decorator">29.6.2.6. Using a context manager as a function decorator</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="contextlib.html#single-use-reusable-and-reentrant-context-managers">29.6.3. Single use, reusable and reentrant context managers</a><ul>
<li class="toctree-l3"><a class="reference internal" href="contextlib.html#reentrant-context-managers">29.6.3.1. Reentrant context managers</a></li>
<li class="toctree-l3"><a class="reference internal" href="contextlib.html#reusable-context-managers">29.6.3.2. Reusable context managers</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="abc.html">29.7. <code class="xref py py-mod docutils literal notranslate"><span class="pre">abc</span></code> — Abstract Base Classes</a></li>
<li class="toctree-l1"><a class="reference internal" href="atexit.html">29.8. <code class="xref py py-mod docutils literal notranslate"><span class="pre">atexit</span></code> — Exit handlers</a><ul>
<li class="toctree-l2"><a class="reference internal" href="atexit.html#atexit-example">29.8.1. <code class="xref py py-mod docutils literal notranslate"><span class="pre">atexit</span></code> Example</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="traceback.html">29.9. <code class="xref py py-mod docutils literal notranslate"><span class="pre">traceback</span></code> — Print or retrieve a stack traceback</a><ul>
<li class="toctree-l2"><a class="reference internal" href="traceback.html#tracebackexception-objects">29.9.1. <code class="xref py py-class docutils literal notranslate"><span class="pre">TracebackException</span></code> Objects</a></li>
<li class="toctree-l2"><a class="reference internal" href="traceback.html#stacksummary-objects">29.9.2. <code class="xref py py-class docutils literal notranslate"><span class="pre">StackSummary</span></code> Objects</a></li>
<li class="toctree-l2"><a class="reference internal" href="traceback.html#framesummary-objects">29.9.3. <code class="xref py py-class docutils literal notranslate"><span class="pre">FrameSummary</span></code> Objects</a></li>
<li class="toctree-l2"><a class="reference internal" href="traceback.html#traceback-examples">29.9.4. Traceback Examples</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="__future__.html">29.10. <code class="xref py py-mod docutils literal notranslate"><span class="pre">__future__</span></code> — Future statement definitions</a></li>
<li class="toctree-l1"><a class="reference internal" href="gc.html">29.11. <code class="xref py py-mod docutils literal notranslate"><span class="pre">gc</span></code> — Garbage Collector interface</a></li>
<li class="toctree-l1"><a class="reference internal" href="inspect.html">29.12. <code class="xref py py-mod docutils literal notranslate"><span class="pre">inspect</span></code> — Inspect live objects</a><ul>
<li class="toctree-l2"><a class="reference internal" href="inspect.html#types-and-members">29.12.1. Types and members</a></li>
<li class="toctree-l2"><a class="reference internal" href="inspect.html#retrieving-source-code">29.12.2. Retrieving source code</a></li>
<li class="toctree-l2"><a class="reference internal" href="inspect.html#introspecting-callables-with-the-signature-object">29.12.3. Introspecting callables with the Signature object</a></li>
<li class="toctree-l2"><a class="reference internal" href="inspect.html#classes-and-functions">29.12.4. Classes and functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="inspect.html#the-interpreter-stack">29.12.5. The interpreter stack</a></li>
<li class="toctree-l2"><a class="reference internal" href="inspect.html#fetching-attributes-statically">29.12.6. Fetching attributes statically</a></li>
<li class="toctree-l2"><a class="reference internal" href="inspect.html#current-state-of-generators-and-coroutines">29.12.7. Current State of Generators and Coroutines</a></li>
<li class="toctree-l2"><a class="reference internal" href="inspect.html#code-objects-bit-flags">29.12.8. Code Objects Bit Flags</a></li>
<li class="toctree-l2"><a class="reference internal" href="inspect.html#command-line-interface">29.12.9. Command Line Interface</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="site.html">29.13. <code class="xref py py-mod docutils literal notranslate"><span class="pre">site</span></code> — Site-specific configuration hook</a><ul>
<li class="toctree-l2"><a class="reference internal" href="site.html#readline-configuration">29.13.1. Readline configuration</a></li>
<li class="toctree-l2"><a class="reference internal" href="site.html#module-contents">29.13.2. Module contents</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="fpectl.html">29.14. <code class="xref py py-mod docutils literal notranslate"><span class="pre">fpectl</span></code> — Floating point exception control</a><ul>
<li class="toctree-l2"><a class="reference internal" href="fpectl.html#example">29.14.1. Example</a></li>
<li class="toctree-l2"><a class="reference internal" href="fpectl.html#limitations-and-other-considerations">29.14.2. Limitations and other considerations</a></li>
</ul>
</li>
</ul>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="zipapp.html"
                        title="previous chapter"><span class="section-number">28.4. </span><code class="xref py py-mod docutils literal notranslate"><span class="pre">zipapp</span></code> — Manage executable python zip archives</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="sys.html"
                        title="next chapter"><span class="section-number">29.1. </span><code class="xref py py-mod docutils literal notranslate"><span class="pre">sys</span></code> — System-specific parameters and functions</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../bugs.html">Report a Bug</a></li>
      <li>
        <a href="https://github.com/python/cpython/blob/3.6/Doc/library/python.rst"
            rel="nofollow">Show Source
        </a>
      </li>
    </ul>
  </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>  
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="sys.html" title="29.1. sys — System-specific parameters and functions"
             >next</a> |</li>
        <li class="right" >
          <a href="zipapp.html" title="28.4. zipapp — Manage executable python zip archives"
             >previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="https://www.python.org/">Python</a> &#187;</li>
        <li>
          <span class="language_switcher_placeholder">en</span>
          <span class="version_switcher_placeholder">3.6.10</span>
          <a href="../index.html">Documentation </a> &#187;
        </li>

          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
    <li class="right">
        

    <div class="inline-search" style="display: none" role="search">
        <form class="inline-search" action="../search.html" method="get">
          <input placeholder="Quick search" type="text" name="q" />
          <input type="submit" value="Go" />
          <input type="hidden" name="check_keywords" value="yes" />
          <input type="hidden" name="area" value="default" />
        </form>
    </div>
    <script type="text/javascript">$('.inline-search').show(0);</script>
         |
    </li>

      </ul>
    </div>  
    <div class="footer">
    &copy; <a href="../copyright.html">Copyright</a> 2001-2020, Python Software Foundation.
    <br />
    The Python Software Foundation is a non-profit corporation.
    <a href="https://www.python.org/psf/donations/">Please donate.</a>
    <br />
    Last updated on Apr 30, 2020.
    <a href="../bugs.html">Found a bug</a>?
    <br />
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 2.3.1.
    </div>

  </body>
</html>